Skip to content

fix(dev): 补齐 WK3 主天气 JSON 替换 - #110

Open
hhh2210 wants to merge 8 commits into
NSRingo:devfrom
hhh2210:codex/wk3-weather-replacement
Open

hhh2210 wants to merge 8 commits into
NSRingo:devfrom
hhh2210:codex/wk3-weather-replacement

Conversation

@hhh2210

@hhh2210 hhh2210 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Ref #106

这个 PR 在满足条件的主 App 请求中协商 Accept: application/json,并在收到 JSON 响应后直接复用既有供应商注入函数处理当前、逐日、逐小时三类天气。

建议整体采用「JSON 优先,FlatBuffer 兜底」的路线,按实际响应的 Content-Type 分流。这套方案由协议层 协议包 #1 、本 PR 的 JSON 路径以及 WeatherKit #111 的 FlatBuffer 路径共同构成,请维护者确认是否按这个方向推进。

改动与修复

  • 在主 App UA(iOS/macOS)及 country/provider/datasets 边界内协商 JSON,复用现有供应商逻辑生成三类天气数据。
  • 修正 cloudrate 0.8 转换 cloudCover 80(先转百分比再取整)、EAQI -1、restOfDayForecast、periodic 以及 UUID/枚举形态问题。
  • 协议依赖直接基于公开 v2.0.5 标签(c87c1dcd)源码构建,沿用现有 lockfile,可与 apple.WeatherKit#1 独立审阅和合并。

验证情况

  • 157 项测试与正式开发构建通过。
  • 在 macOS 27.3 + Surge 6.12 主 App 真机完成苏州、无锡验证:当前、逐日(11 项)、逐小时(274 项)均来自彩云,空气质量采用 EU.EAQI 标准,3 个有界日志窗口合计 30 次刷新成功。
  • 桌面小组件已在 macOS 27.3 真机验证 FlatBuffer 响应并交由 WeatherKit #111 直接改写,本 PR 仅负责主 App 的 JSON 协商,暂不加小组件白名单,可不依赖协议包先行合并。
  • iPhone 与 watchOS 后续分别验收。

详细字段映射和说明见 wk3-weather-json.md。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb32f80d7a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/function/weatherKit3JSON.mjs Resolved
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T10:18:30.082117Z 6e68f0e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hhh2210

hhh2210 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

更新一下最新进展,相关的代码调整和衔接测试已经全部完成:

  • 协议包( 协议包 #1 ,Ready):基于 macOS 27.3 原生框架补全 15 个根产品、42 张表、29 组枚举和 WK3.Codec,通过 11 组脱敏成对样本、全产品合成 fixture 及字节边界回归。
  • JSON 路径(本 PR #110,Ready):157 项测试与构建通过;macOS 27.3 主 App 真机完成苏州/无锡验证(彩云数据源、EU.EAQI 标准,3 个日志窗口合计 30 次刷新成功),可独立审阅合并。
  • FlatBuffer 路径( WeatherKit #111 ,Draft):在 WeatherKit3.mjs 接入 WK3.Codec,成都/苏州真机已通过专用二进制测试模块完成 codec 数值验收;待协议包发布后更新依赖与 lockfile 再合并。

把 #110(6e68f0e)、#111(2bb5d5a)和 协议包 #1 构建产物(SHA-256 前缀 ea6ed8d3)组合测试时自动合并无冲突,161 项测试全部通过(0 跳过),两种构建均通过:主 App 收到 JSON 时跳过二进制编解码,非 JSON 白名单请求(如 Widget)继续走 FlatBuffer。建议整体采用按 Content-Type 分流的「JSON 优先,FlatBuffer 兜底」路线。

hhhoratioxu added a commit to hhhoratioxu/WeatherKit that referenced this pull request Nov 14, 2026
Remove the nine optional cache, coalescing, request budget, cooldown,
statistics, region fallback and alternate-provider controls. Keep original
source settings, per-request timeouts and Apple failure fallback.

Preserve unavailable Apple warnings unless enrichment changes actual data;
retain opaque JSON containers and a normalized Apple fallback on overflow.
Cover periodic and minute-rain edge cases and validate AQ comparison levels.

Add source-native warning language preferences with Auto preserving old
behavior. Normalize reserved expiry values without changing genuine times
or manufacturing an event end. Preserve the original twelve defaults.

Keep the PR's upstream release URLs, original display name, independent
.loon.bundle.js files, package/lockfile policy and attribution. Retain all
seven existing commits. Credit the referenced input-validation direction
from Patrick Yan (NSRingo#108, 24c3f93) and known-container traversal from
hhh2210 (NSRingo#110, f4676fe), as documented in the source.

Validation: 430/430 regressions; 52 compiled Loon scenarios; 15 rewrite/jq
checks; 13 declarations with all twelve original defaults preserved.
Native evidence and remaining limits are documented separately.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant